<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022-12-16
  Time: 17:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"
      integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

<head>
    <title>Title</title>
</head>
<body class="p-3 m-0 border-0 bd-example">
<div class="w-25">
    <form id="updateUser" name="updateUser" method="post" action="${pageContext.request.contextPath}/updateUser">
        <input type="hidden" name="userid" value="${user.getId() }"/>
        <div class="my-3">
            <label for="name" class="form-label">姓名</label>
            <input type="text" class="form-control" id="name" name="name" placeholder="" value="${user.getName()}"
                   required>
            <div class="invalid-feedback">
                姓名必须填写。
            </div>
        </div>

        <div class="my-3">
            <label class="form-label">性别</label>
            <div class="form-check">
                <input id="male" name="gender" type="radio" class="form-check-input"
                       value="0" ${(user.getGender()==0)?'checked' : ''} required>
                <label class="form-check-label" for="male">男</label>
            </div>
            <div class="form-check">
                <input id="female" name="gender" type="radio" class="form-check-input"
                       value="1" ${(user.getGender()==1)?'checked' : ''} required>
                <label class="form-check-label" for="female">女</label>
            </div>
        </div>
        <c:if test="${user!=null}">
            <button type="submit" class="btn btn-primary">修改</button>
        </c:if>
        <c:if test="${user==null}">
            <button type="submit" class="btn btn-primary">新增</button>
        </c:if>

    </form>
</div>


</body>
</html>
